import { onMounted, reactive } from "vue";
import axios from "axios";
export default function () {
    //https://dog.ceo/api/breed/pembroke/images/random
    let dogList = reactive([
        "https://images.dog.ceo/breeds/pembroke/n02113023_7254.jpg",
    ]);
    function getDog() {
        axios
            .get("https://dog.ceo/api/breed/pembroke/images/random")
            .then((res) => {
                console.log(res);
                dogList.push(res.data.message);
            })
            .catch((err) => { });
    }
    //模块化开发里面，也可以写钩子函数
    onMounted(() => {
        getDog()
    });
    //给外部提供
    return { dogList, getDog }
}
